<template>
    <div class="box">
        <van-search v-model="search" placeholder="请输入搜索关键词" @search="onSearch" />

        <van-card v-for="(v, i) in searchList" :key="i" :num="v.goods_number" :price="v.goods_price"
            :title="v.goods_name"
            :thumb="v.goods_small_logo ? v.goods_small_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
    </div>
</template>

<script setup>

import { ref } from "vue"

import { searchApi } from "@/api/api";

let search = ref('')
let searchList = ref([])

const getList = () => {
    searchApi(search.value).then((res) => {
        console.log(res)
        searchList.value = res.data.message.goods
    })
}
getList()

</script>

<style lang="scss" scoped>
.box {
    width: 100%;
    height: 100%;
}
</style>